package com.proj.hot.activity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.proj.hot.R;
import com.proj.hot.utils.ImageLoaderConfigFactory;

/**
 * 电影详情，点击更多进入的界面
 */
public class MovieDetailMoreActivity extends BaseActivity {

    private final String TAG = getClass().getSimpleName();

    private ImageView more_detail_poster;
    private TextView more_detail_drector;
    private TextView more_detail_actor;
    private TextView more_detail_introduction;

    private String posterUrl;
    private String drectorStr;
    private String actorStr;
    private String introductionStr;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_movie_detail_more);
        initView();
        getDate();
        setData();

    }

    private void initView() {
        more_detail_poster = (ImageView) this.findViewById(R.id.more_detail_poster);
        more_detail_drector = (TextView) this.findViewById(R.id.more_detail_drector);
        more_detail_actor = (TextView) this.findViewById(R.id.more_detail_actor);
        more_detail_introduction = (TextView) this.findViewById(R.id.more_detail_introduction);
    }

    private void getDate() {
        Intent intent = getIntent();
        posterUrl = intent.getStringExtra("logo");
        drectorStr = intent.getStringExtra("drector");
        actorStr = intent.getStringExtra("actor");
        introductionStr = intent.getStringExtra("introduction");

        //Log.i(TAG, "posterUrl=" + posterUrl + ",drectorStr=" + drectorStr + ",actorStr=" + actorStr + ",introductionStr=" + introductionStr);
    }

    private void setData() {
        if (null == posterUrl || "".equals(posterUrl)) {
            more_detail_poster.setImageResource(R.drawable.morentu);
        } else {
            ImageLoader.getInstance().displayImage(posterUrl,
                    more_detail_poster, ImageLoaderConfigFactory.getOptionsWithNopic());
        }

        if (null == drectorStr || "".equals(drectorStr)) {
            more_detail_drector.setText("暂无");
        } else {
            more_detail_drector.setText(drectorStr);
        }

        if (null == actorStr || "".equals(actorStr)) {
            more_detail_actor.setText("暂无");
        } else {
            more_detail_actor.setText(actorStr);
        }

        if (null == introductionStr || "".equals(introductionStr)) {
            more_detail_introduction.setText("暂无");
        } else {
            more_detail_introduction.setText(introductionStr);
        }


    }
}
